package com.dnui.seven2.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dnui.seven2.entity.Feedback;
import com.dnui.seven2.entity.Merch;
import com.dnui.seven2.service.FeedbackService;
import com.dnui.seven2.mapper.FeedbackMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author fengy
 * @description 针对表【feedback】的数据库操作Service实现
 * @createDate 2022-10-16 10:08:56
 */
@Service
public class FeedbackServiceImpl extends ServiceImpl<FeedbackMapper, Feedback>
        implements FeedbackService{

    @Autowired
    private FeedbackMapper feedbackMapper;

    @Override
    public List<Feedback> queryFeedbacks(Integer currentPageNum, Integer everyPage) {
        Page page=new Page(currentPageNum,everyPage);
        feedbackMapper.selectPage(page, null);
        return page.getRecords();
    }

    @Override
    public Feedback queryById(Long feedbackId) {
        return feedbackMapper.selectById(feedbackId);
    }



    @Override
    public void deleteFeedback(Long feedbackId) {
        feedbackMapper.deleteById(feedbackId);
    }

    @Override
    public void updateFeedback(Feedback feedback) {
        feedbackMapper.updateById(feedback);
    }

    @Override
    public List<Feedback> selectAll() {
        //构造条件构造器
        LambdaQueryWrapper<Feedback> queryWrapper=new LambdaQueryWrapper();
        List<Feedback> feedbacks = feedbackMapper.selectList(null);
        return feedbacks;
    }
}




